﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PrVyd.Zakladni_tridy;

namespace PrVyd.Dialogova_okna
{
    partial class PridatPolozku : Form
    {
        public Item Polozka { get; set; }
        
        public PridatPolozku()
        {
            InitializeComponent();
            Polozka = new Item();
        }

        private void OKButton_Click(object sender, EventArgs e)
        {
            if (NazevPolozky.Text.Length == 0 || Pocet.Value == 0)
            {
                this.DialogResult = DialogResult.None;
            }
            else
            {
                Polozka.Name = NazevPolozky.Text;
                Polozka.Count = (Int32) Pocet.Value;
                Polozka.Description = PopisRichText.Text;
                Polozka.Price = Decimal.Parse(CenaBezDane1.Text) + Decimal.Parse(CenaBezDane2.Text) / 100;
                Polozka.Tax = Decimal.Parse(Dan1.Text) + Decimal.Parse(Dan2.Text) / 100;
                this.DialogResult = DialogResult.OK;

            }
        }

        private void CancelButton_Click(object sender, EventArgs e)
        {

        }
    }
}
